package org.xx.armory.swing.builders;

import org.xx.armory.objectparser.LineInfo;
import org.xx.armory.objectparser.ParsedObject;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

public class RowModel
        extends ParsedObject {
    private final int stretch;
    private final ModelAlignment alignment;
    private final List<CellModel> cells;

    /**
     * 构造解析对象。
     *
     * @param lineInfo
     *         源文件中的位置信息。
     */
    protected RowModel(
            LineInfo lineInfo,
            int stretch,
            ModelAlignment alignment,
            Collection<? extends CellModel> cells
    ) {
        super(lineInfo);
        this.stretch = stretch;
        this.alignment = alignment;
        this.cells = cells != null ? new ArrayList<>(cells) : Collections.emptyList();
    }

    public final int getStretch() {
        return this.stretch;
    }

    public final ModelAlignment getAlignment() {
        return this.alignment;
    }

    public final List<CellModel> getCells() {
        return this.cells;
    }
}
